def add(a, b):
    return a + b

def subtract(a, b):
    return a - b

def multiply(a, b):
    return a * b

def divide(a, b):
    if b == 0:
        raise ValueError("除数不能为零")
    return a / b

def calculator():
    print("简易计算器")
    print("支持的操作：+ (加法), - (减法), * (乘法), / (除法)")
    
    try:
        num1 = float(input("请输入第一个数字："))
        operation = input("请输入操作符：")
        num2 = float(input("请输入第二个数字："))
        
        if operation == '+':
            result = add(num1, num2)
        elif operation == '-':
            result = subtract(num1, num2)
        elif operation == '*':
            result = multiply(num1, num2)
        elif operation == '/':
            result = divide(num1, num2)
        else:
            print("不支持的操作符")
            return
        
        print(f"结果: {num1} {operation} {num2} = {result}")
    
    except ValueError as e:
        print(f"错误: {e}")
    except Exception as e:
        print(f"发生错误: {e}")

if __name__ == "__main__":
    calculator()